//
//  ChatsController.h
//  SolarSeek
//
//  Created by Erick Fejta on 05/05/21.
//  Copyright 2005 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>

#import "Chats.h"
#import "SolarSeekEngine.h"

#import "KVMutableSet.h"


@interface ChatsController : NSObject {
	SolarSeekEngine *_engine;
	
	KVMutableSet *_rooms;
	KVMutableSet *_chats;
	KVMutableSet *_chatsPrivate;
	KVMutableSet *_chatsRoom;
	
	KVMutableSet *_chatsList;
	KVMutableSet *_chatsJoined;
	KVMutableSet *_chatsJoining;
	KVMutableSet *_chatsLeft;
	KVMutableSet *_chatsInside;
	
}

- (id)initWithEngine:(SolarSeekEngine *)engine;

- (KVMutableSet *)chatsAll;		//all chats we are paying attention to
- (KVMutableSet *)chatsRoom;	//all room chats we are paying attention to
- (KVMutableSet *)chatsPrivate;	//all private chats we are paying attention.
- (KVMutableSet *)chatsList;	//the list of room chats.
- (KVMutableSet *)chatsJoined;	//chats the server thinks we're joined in
- (KVMutableSet *)chatsInside;	//chats we want to be joined in.
- (KVMutableSet *)rooms;

#pragma mark actions

- (RoomChat *)chatWithRoom:(Room *)room autojoin:(BOOL)join; //join -> send join message if not in room.
- (RoomChat *)chatWithRoom:(Room *)room;
- (PrivateChat *)chatWithPeer:(Peer *)peer;

- (Room *)roomNamed:(NSString *)room;

- (void)say:(NSString *)statement inChat:(Chat *)chat;
- (void)say:(NSString *)statement toPeer:(Peer *)peer;
- (void)say:(NSString *)statement toRoom:(Room *)room;

- (void)endChat:(Chat *)chat;

- (void)addRoomToList:(Room *)room;
- (void)removeRoomFromList:(Room *)room;


@end
